from airtest.core.settings import Settings
from airtest.core.api import *
import win32gui
import os

base_root = os.path.dirname(os.path.dirname(__file__))

name = "Morningstar Direct"
ClassName = "MstarAWDDIRECTClass"


def Connect_MSDirect():
    """
    使用Airtest库必须调用此函数！！！
    连接MS Direct 窗口句柄
    直接调用Airtest库常用的方法
    :return:
    """
    handle = win32gui.FindWindow(ClassName, name)
    auto_setup(__file__, logdir=True, devices=[f"Windows:///{handle}"])


print(base_root)
Connect_MSDirect()
Settings().LOG_DIR = os.path.join(base_root, 'Airtest_pra/log_pra')
snapshot(os.path.join(base_root, 'Airtest_pra/log_pra/1.png'), quality=80, max_size=800)
